<template>
	<view class="mbti">
		<view class="top-control flex-row-start-center" :style="{top:topControlTop+'rpx'}">
			<view class="product-name flex-row-start-center" v-if="actDevice">
				<text>Clackey</text>
				<image class="product-name-icon"
					src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/7d43c76d37724a8faba5a46f61f8cdb0.png"
					mode="aspectFill"></image>
			</view>
			<view class="to-user-info"
				:style="{left:toUserInfoLeft+'rpx',width:rpxMenuButtonHeight+'rpx',height:rpxMenuButtonHeight+'rpx'}">
				<image class="cover-img" style="border-radius: 50%;" :src="userInfo.headUrl" mode="aspectFill"
					@click="handleToLoginOrUserInfo" v-if="userInfo&&userInfo.headUrl"></image>
				<image class="cover-img" style="border-radius: 50%;"
					src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/0b672ae762884dcb856169754e29902f.png"
					mode="aspectFill" @click="handleToLoginOrUserInfo" v-else></image>
			</view>
		</view>
		<view class="mbti-content flex-column-start-center" :style="{'background-image': `url(${bgUrl})`}">
			<view class="top-box" :style="{height:contentTop+'rpx'}"></view>
			<view class="content-box">
				<view class="device-choose flex-row-start-center">
					<view class="device-avatar flex-row-center-center" @click="handleTDeviceDetail">
						<image class="cover-img" :src="actDevice.deviceAvatar" mode="aspectFill" v-if="actDevice">
						</image>
						<image class="cover-img"
							src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/23188c7dfaca49dab415114dc04f922c.png"
							mode="aspectFill" v-else></image>
					</view>
					<view class="device-info flex-column-center-start" @click="handleTDeviceDetail">
						<view class="info-name flex-row-start-center" v-if="actDevice">
							<view class="info-user-name" v-if="actDevice">{{actDevice.alias}}</view>
							<view class="info-product-name" style="font-weight: 400;">
								的Clackey
							</view>
							<view class="info-icon">
								<image class="cover-img" :src="actDevice.devicePersonalityLabel" mode="aspectFill">
								</image>
							</view>
						</view>
						<view class="info-name flex-row-start-center" v-else>
							我的Clackey
						</view>
						<view class="info-nickname" v-if="actDevice">{{actDevice.deviceNickName}}</view>
					</view>

					<!-- 控制 -->
					<view class="device-control flex-row-center-center" v-if="actDevice">
						<image class="cover-img"
							src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/d157b47784d6421588fc865b06148dc4.png"
							mode="aspectFill"></image>
						<view class="device-control-click-area" @click="handleChooseDevice">
						</view>
					</view>

					<!-- 控制1 -->

					<view class="device-control-add flex-row-end-center" v-else>
						<view class="device-control-add-text">去添加</view>
						<image class="device-control-add-icon"
							src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/d0a057817adf4f4ebe5751b3dc4cf38a.png"
							mode="aspectFill"></image>
						<view class="device-control-click-area" @click="handleToAddNewDevice">
						</view>
					</view>

				</view>
				<view class="control-row flex-row-start-center">
					<view class="control-row-item flex-row-start-end" style="margin-right: 22rpx;"
						@click="handleControlClick('firend')">
						<view class="control-link-internet flex-row-end-center">
							<view class="control-link-text flex-row-end-center" v-if="!firendList.length">暂无好友</view>
							<view class="control-firends-avatar flex-row-end-center" v-else>
								<view class="firends-avatar-item" style="border-radius: 50%;"
									v-for="(item,index) in firendList" :key="index" :class="{'hide-item':index>2}">
									<image class="cover-img" :src="item.headUrl" style="border-radius: 50%;"
										mode="aspectFill"></image>
								</view>
							</view>
							<image class="go-to-icon"
								src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/6f30acdbefb4420d940744b20cf63832.png"
								mode="aspectFill" style="vertical-align: middle;margin-top: 4rpx;"></image>
						</view>

						<view class="bottom-tip-row flex-row-start-center">
							<view class="control-icon flex-row-center-center">
								<image class="cover-img"
									src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/164009f6e2644be2b5b8a44d0b72aa6f.png"
									mode="aspectFill"></image>
							</view>
							<view class="control-tip-text">
								<view class="control-name">贴贴好友</view>
								<view class="control-tip">多台Clackey贴近</view>
							</view>
						</view>



					</view>
					<view class="control-row-item flex-column-end-start" @click="handleControlClick('link')">
						<view class="control-link-internet flex-row-end-center"
							:class="{'is-link-internet':actDevice.isLinkInternet}">
							<view class="control-link-text flex-row-end-center" v-if="!actDevice.isLinkInternet">未联网
							</view>
							<view class="control-link-text flex-row-end-center" v-else>已联网</view>
							<image class="go-to-icon"
								src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/6f30acdbefb4420d940744b20cf63832.png"
								mode="aspectFill" style="vertical-align: middle;margin-top: 4rpx;"></image>
						</view>

						<view class="bottom-tip-row flex-row-start-center">
							<view class="control-icon flex-row-center-center">
								<image class="cover-img"
									src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/5018ed28c1094fda925abe63fd6de369.png"
									mode="aspectFill"></image>
							</view>
							<view class="control-tip-text">
								<view class="control-name">设备设置</view>
								<view class="control-tip">网络连接</view>
							</view>
						</view>

					</view>
				</view>
				<view class="firends-gruop flex-column-start-center">
					<view class="group-top-info flex-row-start-center" @click="handleControlClick('group')">
						<view class="gruop-icon">
							<image class="cover-img"
								src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/e55e416e9df24bd88d7b3c7372bbb2ad.png"
								mode="aspectFill"></image>
						</view>
						<view class="group-tip">
							<view class="group-control-name">TapTap</view>
							<view class="group-control-tip">拍拍群组</view>
						</view>
						<image class="go-to-icon"
							src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/6f30acdbefb4420d940744b20cf63832.png"
							mode="aspectFill"></image>
					</view>

					<view class="gorup-bottom-content flex-row-start-start">
						<!-- 好友组为空的时候 -->
						<view class="empty-tip flex-row-center-center" v-if="!showThreeGroups.length">暂无群组</view>
						<view class="group-swiper">

						</view>
						<!-- 好友组有的时候 -->
						<!-- :style="{'display':showThreeGroups.length?'flex':'none'}" -->
						<view class="group-item flex-column-end-start"
							:class="{'act-group-item':actGroupChooseIndex==index}"
							v-for="(item,index) in showThreeGroups" :key="index" @click="handleGroupClick(item,index)"
							style="display: none;">
							<view class="choosed-icon"></view>
							<view class="group-avatar-row flex-row-start-center">
								<view class="group-avatar-item" v-for="(ritem,rindex) in item.avatarRow2" :key="rindex"
									:class="{'group-avatar-item-hide':rindex>1}">
									<image class="cover-img" style="border-radius: 50%;" :src="ritem.headUrl"
										mode="aspectFill">
									</image>
								</view>
								<view class="group-avatar-item flex-row-center-center" v-if="item.avatarRow2.length>=3">
									<view class="group-avatar-more-point"></view>
									<view class="group-avatar-more-point"></view>
									<view class="group-avatar-more-point"></view>
								</view>
							</view>
							<view class="group-avatar-row flex-row-start-center">
								<view class="group-avatar-item" v-for="(ritem,rindex) in item.avatarRow1" :key="rindex">
									<image class="cover-img" style="border-radius: 50%;" :src="ritem.headUrl"
										mode="aspectFill">
									</image>
								</view>
							</view>
							<view class="grop-name">{{item.friendGroup}}</view>

						</view>

					</view>


					<!--设备相关底部背景 -->
					<view class="bottom-bg" v-if="actDevice">
						<image class="cover-img" :src="actDevice.bottomBg" mode="aspectFill"></image>
					</view>

					<!-- 没有设备时 -->
					<view class="device-none-bottom flex-row-center-center" v-else>
						<text>Clackey</text>
						<image class="product-name-icon"
							src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/7d43c76d37724a8faba5a46f61f8cdb0.png"
							mode="aspectFill"></image>
					</view>
				</view>

			</view>
		</view>

		<mbtiPop ref="mbtiPop" @confirmValue="handlePopConfirm" @cancel="handlePopCancel" @callBack="handlePopCallBack">
			<view class="device-list">
				<scroll-view ref="scrollView" :scroll-y="true" class="scroll-content" :show-scrollbar="false"
					:scroll-with-animation="true">
					<view class="device-list-content">
						<view class="device-item flex-row-start-center" v-for="(item,index) in deviceList" :key="index"
							:class="{'device-item-choose':nowClickDeviceIndex==index}"
							@click="handleDeviceItemClick(item,index)">
							<view class="device-avatar">
								<image class="cover-img" :src="item.deviceAvatar" style="border-radius: 50%;"
									mode="aspectFill"></image>
							</view>
							<view class="device-name">
								{{item.alias}}的Clackey
							</view>
							<view class="device-label">
								<image class="cover-img" :src="item.devicePersonalityLabel" mode="aspectFill"></image>
							</view>
						</view>
						<view class="device-item flex-row-start-center" @click="handleToAddNewDevice">
							<view class="device-avatar">
								<image class="cover-img"
									src="https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/70ac382b4800414eb6b70621ecc06812.png"
									style="border-radius: 50%;" mode="aspectFill"></image>
							</view>
							<view class="device-name device-name-add">
								添加新的Clackey
							</view>
							<view class="device-label">
							</view>
						</view>

					</view>

				</scroll-view>
			</view>


		</mbtiPop>
	</view>
</template>

<script>
	import mbtiPop from "@/components/m-mbti/mbti-pop.vue"
	import {
		groups
	} from "@/components/m-mbti/mockData.js";
	import {
		getMbtiSourceByKey
	} from "@/utils/mbti-source.js"
	import {
		mapGetters
	} from "vuex";
	import {
		getFriendList,
		getFriendGropList,
		getUserDevice,
		changeDeviceLogin,
		toTopGroup
	} from "@/api/mbti.js"
	import storage from "@/utils/storage";
	export default {
		components: {
			mbtiPop
		},
		data() {
			return {
				actGroupChooseIndex: 0,
				nowClickDeviceIndex: 0,
				actDeviceId: 0,
				showThreeGroups: [],
				groupList: [],
				firendList: [],
				deviceList: [{
						id: 0,
						deviceName: "阿龙龙的Clackey",
						deviceNickName: "绿老头",
						deviceAvatar: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/31edeb8d844a48f58c1d07805c445d58.png",
						devicePersonalityLabel: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/2742d4631ccf4e12a7cd8ea71d5bb2d1.png"
					},
					{
						id: 1,
						deviceName: "夜行记夜行记夜行记的Clackey",
						deviceNickName: "电钻哥",
						deviceAvatar: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/211b035f23c2479c85aeef294c3a4108.png",
						devicePersonalityLabel: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/2742d4631ccf4e12a7cd8ea71d5bb2d1.png"
					},
				],

				// 当前设备
				actDevice: null,

				// {
				// 	id: 0,
				// 	deviceName: "阿龙龙的Clackey",
				// 	deviceNickName: "绿老头",
				// 	deviceAvatar: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/31edeb8d844a48f58c1d07805c445d58.png",
				// 	devicePersonalityLabel: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/2742d4631ccf4e12a7cd8ea71d5bb2d1.png",
				// 	isLinkInternet: true
				// },


				bgUrl: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/d394a848c52a40a0b7fc9baf22ba6a01.png",
				screenWidth: 375,
				rpxMenuButtonHeight: 64,
				rpxMenuButtonTop: 100,
				rpxMenuButtonWidth: 174,
				contentTop: 300,

				topControlTop: 104,
				toUserInfoLeft: 648,
				bottomBgUrl: "https://cdn.osisx.com/e416845113cdf0df55ad616de9bf72b2/image/d6c26e2d5cf74a078c600dc42ae61557.png",

			}
		},
		watch: {

		},
		computed: {
			...mapGetters(['userInfo']),

		},
		created() {
			try {
				let screenWidth = uni.getStorageSync('screenWidth')
				if (screenWidth) {
					this.screenWidth = screenWidth
				} else {
					this.screenWidth = uni.getSystemInfoSync().screenWidth; // 当前设备屏幕宽度
					uni.setStorageSync("screenWidth", this.screenWidth)
				}
				let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
				let {
					top,
					height,
					width,
					left,
				} = menuButtonInfo

				let rpxHeight = this.pxToRpx(height)
				let rpxTop = this.pxToRpx(top)
				let rpxWidth = this.pxToRpx(width)
				let rpxLeft = this.pxToRpx(left)
				this.rpxMenuButtonHeight = rpxHeight
				this.rpxMenuButtonTop = rpxTop
				this.rpxMenuButtonWidth = rpxWidth

				this.contentTop = rpxTop + rpxHeight + 96
				this.topControlTop = rpxTop - ((60 - rpxHeight) / 2)
				this.toUserInfoLeft = rpxLeft - 28 - rpxHeight

			} catch (error) {
				//TODO handle the exception
			}
		},
		onShow() {
			this.loadData()
		},
		methods: {
			pxToRpx(px) {
				const designWidth = 750; // 设计稿宽度
				const rpx = (designWidth / this.screenWidth) * px; // 根据屏幕宽度计算 rpx
				return rpx;
			},
			splitNameEnhanced(inputStr) {
				const index = inputStr.indexOf('的');
				if (index === -1) return [inputStr, '']; // 容错处理
				return [
					inputStr.substring(0, index),
					inputStr.substring(index)
				];
			},
			hasLogin() {
				let token = storage.getAccessToken()
				if (!token) {
					return false
				} else {
					return true
				}
			},
			loadData() {
				let flag = this.hasLogin()
				if (!flag) {
					return
				}
				// this.handleGetGroups()
				this.handleGetFirendList()
				this.handleGetFriendGropList()
				this.handleGetUserDevice()
			},
			handleTDeviceDetail() {
				let flag = this.hasLogin()
				if (!flag) {
					this.handleToLoginOrUserInfo()
					return
				}
				uni.navigateTo({
					url: `/pages/mbti/mbti-device-detail?id=${this.actDevice.id}`
				})

			},
			handleToTopGroup(id) {
				toTopGroup(id).then(res => {
					uni.showToast({
						title: "置顶成功",
						icon: "none"
					})
					this.loadData()
				})
			},
			handleChangeDeviceLogin(deviceId) {
				changeDeviceLogin(deviceId).then(res => {
					this.loadData()
					uni.showToast({
						title: "切换成功",
						icon: "none"
					})

				})
			},
			handleGetUserDevice() {
				getUserDevice().then(res => {
					let list = res.data.data
					let code = res.data.code
					if (code == '401') {
						this.handleGetUserDevice()
						return
					}
					list = [...list].map((item, index) => {
						let deviceNickName = ""
						let deviceAvatar = ""
						let bottomBg = ""
						let devicePersonalityLabel = ""
						let deveiceSource = getMbtiSourceByKey(item.mbti)
						if (deveiceSource) {
							deviceNickName = deveiceSource.nickName
							deviceAvatar = deveiceSource.largeAvatar
							bottomBg = deveiceSource.clearBottomBg
							devicePersonalityLabel = deveiceSource.label
						}

						if (item.hasLogin) {
							this.nowClickDeviceIndex = index
							this.actDeviceId = item.id
						}

						return {
							...item,
							deviceNickName,
							deviceAvatar,
							bottomBg,
							devicePersonalityLabel
						}
					})
					let obj = [...list].find((item, index) => {
						return item.hasLogin
					})
					this.actDevice = obj
					this.deviceList = list

					console.log("设备获取", this.deviceList);
				})
			},
			handleGetFirendList() {
				getFriendList().then(res => {
					let list = res.data.data
					let code = res.data.code
					if (code == '401') {
						this.handleGetFirendList()
						return
					}

					this.firendList = list.map((item, index) => {
						let source = getMbtiSourceByKey(item.mbti)
						let mbtiAvatar = ""
						if (source) {
							mbtiAvatar = source.smallAvatar
						}
						return {
							...item,
							mbtiAvatar: source.smallAvatar
						}
					})
				})

			},
			handleGetFriendGropList() {
				getFriendGropList().then(res => {
					let list = res.data.data
					let code = res.data.code
					if (code == '401') {
						this.handleGetFriendGropList()
						return
					}

					if (!list) {
						return
					}
					this.groupList = [...list].map((item, index) => {
						if (item.hasTop === 0) {
							this.actGroupChooseIndex = index
						}
						// item.friendRelationshipList.forEach((fitem, findex) => {
						// 	let source = getMbtiSourceByKey(item.mbti)
						// 	let mbtiAvatar = ""
						// 	if (source) {friendRelationshipList
						// 		mbtiAvatar = source.smallAvatar
						// 	}
						// 	fitem.mbtiAvatar = mbtiAvatar
						// })
						return {
							...item,

						}
					})

					// console.log("分组是", this.groupList);

					this.showThreeGroups = this.groupList.filter((item, index) => {
						return index < 3
					}).map((item, index) => {
						let avatarRow1 = []
						let avatarRow2 = []
						avatarRow1 = item.friendRelationshipList.filter((citem, cindex) => {
							return cindex < 3
						})

						if (item.friendRelationshipList.length > 3) {
							avatarRow2 = item.friendRelationshipList.filter((citem, cindex) => {
								return cindex > 2
							})
						}

						return {
							...item,
							avatarRow1,
							avatarRow2
						}

					})
				})
			},
			handleGroupClick(item, index) {
				this.handleToTopGroup(item.id)
				// 之后通过置顶更新切换
				// this.actGroupChooseIndex = index
				// uni.showToast({
				// 	title: "置顶成功",
				// 	icon: "none"
				// })
			},
			handleGetGroups() {
				groups.forEach((item, index) => {
					if (item.isChoosed) {
						this.actGroupChooseIndex = index
					}
				})
				// 之后走接口
				this.showThreeGroups = groups.filter((item, index) => {
					return index < 3
				}).map((item, index) => {
					let avatarRow1 = []
					let avatarRow2 = []
					avatarRow1 = item.avatarList.filter((citem, cindex) => {
						return cindex < 3
					})

					if (item.avatarList.length > 3) {
						avatarRow2 = item.avatarList.filter((citem, cindex) => {
							return cindex > 2
						})
					}

					return {
						...item,
						avatarRow1,
						avatarRow2
					}

				})

			},
			handleToAddNewDevice() {
				let flag = this.hasLogin()
				if (!flag) {
					this.handleToLoginOrUserInfo()
					return
				}
				uni.navigateTo({
					url: "/pages/mbti/mbti-link-device"
				})
				this.$refs.mbtiPop.close()
			},
			handlePopCallBack() {

			},
			handlePopCancel() {
				// 还原nowClickDeviceIndex
				this.nowClickDeviceIndex = this.deviceList.findIndex(e => {
					return e.id == this.actDevice.id
				})
			},
			handlePopConfirm(e) {
				let device = this.deviceList.find((item, index) => {
					return index === this.nowClickDeviceIndex
				})
				if (device) {
					this.handleChangeDeviceLogin(device.id)
				}
			},
			handleChooseDevice() {
				this.$refs.mbtiPop.open({
					title: "切换/添加你的Clackey",
				})
			},
			handleDeviceItemClick(item, index) {
				let flag = this.hasLogin()
				if (!flag) {
					this.handleToLoginOrUserInfo()
					return
				}
				// 说明：actDeviceId是在获取数据的时候赋值的，更新数据重新赋值，nowClickDeviceIndex只是用作点击切换效果，一旦获取设备列表数据也就是打开pop，就料立即将当前设备的index复制给它 
				this.nowClickDeviceIndex = index

				if (item.id != this.actDeviceId) {
					this.$refs.mbtiPop.handleControlConfirm(true)
					// 点击了确定，就去切换设备就好了
				} else {
					this.$refs.mbtiPop.handleControlConfirm(false)
				}
			},
			handleToLoginOrUserInfo() {
				uni.navigateTo({
					url: "/pages/mbti/mbti-login"
				})
			},
			handleControlClick(type) {
				let flag = this.hasLogin()
				if (!flag) {
					this.handleToLoginOrUserInfo()
					return
				}
				if (type == 'link') {
					uni.navigateTo({
						url: "/pages/mbti/mbti-link-device"
					})
				} else if (type == 'firend') {
					uni.navigateTo({
						url: "/pages/mbti/mbti-firends"
					})
				} else if (type == 'group') {
					uni.navigateTo({
						url: "/pages/mbti/mbti-groups"
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.mbti {
		position: absolute;
		left: 0rpx;
		top: 0rpx;
		width: 100%;
		height: 100%;
		background-color: #ededed;
		box-sizing: border-box;

		.device-none-bottom {
			position: absolute;
			left: 0rpx;
			top: 626rpx;
			width: 100%;
			height: 60rpx;
			font-weight: bold;
			font-size: 52rpx;
			color: #153135;
			line-height: 60rpx;
		}

		.bottom-bg {
			position: absolute;
			left: 50%;
			transform: translateX(-50%);
			top: 414rpx;
			width: 100vw;
			height: 520rpx;
			z-index: 9999;
			pointer-events: none;
		}

		.mbti-content {
			width: 100%;
			height: 100%;
			background-repeat: no-repeat;
			background-size: cover;
			background-position: center center;
			padding: 0rpx 48rpx;

			.top-box {
				width: 100%;
			}

			.content-box {
				position: relative;
				width: 100%;
				flex: 1;

				.device-choose {
					width: 100%;
					height: 132rpx;
					margin-bottom: 36rpx;

					.device-avatar {
						width: 132rpx;
						height: 132rpx;
						margin-right: 18rpx;
					}

					.device-info {
						flex: 1;
						height: 100%;

						.info-name {
							width: 100%;
							height: 52rpx;
							font-weight: 300;
							font-size: 38rpx;
							color: #153135;
							line-height: 52rpx;

							.info-icon {
								width: 80rpx;
								height: 36rpx;
								margin-left: 12rpx;
							}

							.info-user-name {
								font-weight: 500;
							}
						}



						.info-nickname {
							width: 100%;
							height: 42rpx;

							font-weight: 300;
							font-size: 30rpx;
							color: #6C7A6A;
							line-height: 42rpx;
						}
					}

					.device-control {
						position: relative;
						width: 24rpx;
						height: 14rpx;
						z-index: 999;

					}

					.device-control-add {
						position: relative;

						.device-control-add-text {
							height: 34rpx;
							font-weight: 400;
							font-size: 24rpx;
							color: #153135;
							line-height: 34rpx;
							margin-right: 12rpx;
						}

						.device-control-add-icon {
							width: 14rpx;
							height: 24rpx;
						}
					}


					.device-control-click-area {
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
						width: 60rpx;
						height: 60rpx;
						z-index: 99999;
					}
				}

				.control-row {
					width: 100%;
					height: 260rpx;
					margin-bottom: 22rpx;

					.control-row-item {
						position: relative;
						flex: 1;
						height: 100%;
						background: #FFFFFF;
						border-radius: 24rpx;
						// padding: 20rpx 28rpx;
						// padding: 0rpx 24rpx;

						.control-link-internet {
							position: absolute;
							left: 0rpx;
							top: 22rpx;
							width: 100%;
							height: 34rpx;
							font-weight: 300;
							font-size: 24rpx;
							color: #C6C6C6;
							// line-height: 34rpx;
							line-height: 24rpx;
							padding: 0rpx 24rpx;

							.control-link-text {
								// height: 34rpx;
								// background-color: pink;
							}

							.control-firends-avatar {
								flex: 1;
								height: 36rpx;

								.firends-avatar-item {
									width: 36rpx;
									height: 36rpx;
									margin-right: 6rpx;
									border-radius: 50%;

									&:last-child {
										margin-right: 0rpx;
									}
								}
							}






						}

						.is-link-internet {
							color: #6DD400;
							font-weight: 400;
						}


						.bottom-tip-row {
							width: 100%;
							margin-bottom: 20rpx;
						}

						.control-icon {
							width: 68rpx;
							height: 68rpx;
							margin-right: 12rpx;
							margin-left: 24rpx;
						}

						.control-tip-text {
							flex: 1;
						}

						.control-name {
							width: 100%;
							height: 42rpx;
							font-weight: 500;
							font-size: 30rpx;
							color: #494949;
							line-height: 42rpx;
						}

						.control-tip {
							width: 100%;
							height: 34rpx;
							font-weight: 400;
							font-size: 24rpx;
							color: #C6C6C6;
							line-height: 34rpx;
						}
					}
				}

				.firends-gruop {
					position: relative;
					width: 100%;
					height: 528rpx;
					background: #FFFFFF;
					border-radius: 24rpx;
					padding: 0rpx 24rpx;

					.group-top-info {
						position: relative;
						width: 100%;
						height: 126rpx;

						&::after {
							position: absolute;
							left: 0rpx;
							bottom: 0rpx;
							content: "";
							width: 100%;
							height: 0.5rpx;
							background-color: #ebebeb;

						}

						.gruop-icon {
							width: 68rpx;
							height: 68rpx;
							margin-right: 12rpx;
						}

						.group-tip {
							flex: 1;

							.group-control-name {
								height: 44rpx;
								font-weight: 600;
								font-size: 32rpx;
								color: #494949;
								line-height: 44rpx;
							}

							.group-control-tip {
								height: 34rpx;
								font-weight: 400;
								font-size: 24rpx;
								color: #C6C6C6;
								line-height: 34rpx;
							}

						}


					}

					.gorup-bottom-content {
						position: relative;
						flex: 1;
						width: 100%;



						.empty-tip {
							position: absolute;
							left: 50%;
							top: 50%;
							transform: translate(-50%, -50%);
							width: 100%;
							height: 34rpx;
							font-weight: 300;
							font-size: 24rpx;
							color: #C6C6C6;
							line-height: 34rpx;
						}

						.group-swiper {
							width: 100%;
							height: 292rpx;
							margin-top: 38rpx;
							background-color: pink;
						}

						.group-item {
							position: relative;
							// flex: 1;
							width: calc((100% - 24rpx)/3);
							margin-right: 12rpx;
							height: 292rpx;
							border-radius: 8rpx;
							border: 1rpx solid #CECECE;
							overflow: hidden;
							margin-top: 38rpx;

							.group-avatar-row {
								width: 100%;
								height: 48rpx;
								padding-left: 20rpx;
								margin-bottom: 20rpx;

								.group-avatar-item {
									width: 48rpx;
									height: 48rpx;
									border-radius: 50%;
									margin-right: 8rpx;

									.group-avatar-more-point {
										width: 4rpx;
										height: 4rpx;
										margin-right: 4rpx;
										border-radius: 50%;
										background: #979797;

										&:last-child {
											margin-right: 0rpx;
										}
									}

									&:last-child {
										margin-right: 0rpx;
									}
								}

								.group-avatar-item-hide {
									display: none;
								}

							}

							&:last-child {
								margin-right: 0rpx;
							}

							.grop-name {
								width: 100%;
								height: 40rpx;
								font-weight: 400;
								font-size: 28rpx;
								color: #494949;
								line-height: 40rpx;
								margin-bottom: 20rpx;
								padding: 0rpx 20rpx;

								text-overflow: ellipsis;
								overflow: hidden;
								word-break: break-all;
								white-space: nowrap;
							}

							.choosed-icon {
								position: absolute;
								right: 16rpx;
								top: 16rpx;
								width: 32rpx;
								height: 32rpx;
								border: 2rpx solid #CECECE;
								border-radius: 50%;
							}
						}

						.act-group-item {
							border: 2rpx solid #6DD400;




							.choosed-icon {
								background-color: #6DD400;
								border: 2rpx solid #B0FF5C;
								animation: sexScaleAni 0.2s ease-in-out;

								@keyframes sexScaleAni {
									0% {
										transform: scale(1);
									}

									50% {
										transform: scale(1.1);
									}

									100% {
										transform: scale(1);
									}
								}
							}




						}


					}
				}
			}
		}

		.top-control {
			position: absolute;
			left: 0rpx;
			top: 0rpx;
			width: 100%;
			height: 60rpx;
			z-index: 999;
			padding: 0rpx 48rpx;

			.product-name {
				flex: 1;
				height: 100%;
				font-weight: bold;
				font-size: 52rpx;
				color: #153135;
				line-height: 60rpx;


			}

			.to-user-info {
				position: absolute;
				top: 50%;
				transform: translateY(-50%);
				width: 58rpx;
				height: 58rpx;
				border-radius: 50%;
			}
		}

		.device-list {
			position: absolute;
			left: 50%;
			top: -8rpx;
			transform: translateX(-50%);
			width: 100vw;
			height: 100%;

			.device-list-content {
				width: 100%;
				padding: 0rpx 48rpx;
				padding-top: 8rpx;

				.device-item {
					width: 100%;
					height: 148rpx;
					background: #FFFFFF;
					border-radius: 20rpx;
					padding: 0rpx 28rpx;
					margin-bottom: 24rpx;

					.device-avatar {
						width: 92rpx;
						height: 92rpx;
						border-radius: 50%;
						margin-right: 20rpx;

					}

					.device-name {
						flex: 1;
						font-weight: 400;
						font-size: 32rpx;
						color: #494949;
						line-height: 40rpx;
					}

					.device-name-add {
						color: #979797;
						line-height: 44rpx;
					}

					.device-label {
						width: 80rpx;
						height: 36rpx;
						margin-left: 44rpx;
					}
				}

				.device-item-choose {
					box-shadow: 0rpx 0rpx 4rpx 4rpx rgba(109, 212, 0, 0.5);
				}
			}
		}
	}

	.go-to-icon {
		width: 12rpx;
		height: 20rpx;
		margin-left: 12rpx;
		// background-color: pink;
	}

	.hide-item {
		display: none;
	}

	.product-name-icon {
		width: 52rpx;
		height: 52rpx;
		margin-left: 16rpx;
		vertical-align: middle;
	}
</style>